<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>修改登录日志</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <script type="text/javascript" src="../../common/js/public.js"></script>
    <script type="text/javascript" src="../../common/js/publicUtils.js"></script>
    <style>
        .layui-input-inline,.buttondiv .layui-input-inline {
            float: left;
            width: 450px !important;
            margin-right: 10px;
        }
        .error{
            color: red;
            line-height: 20px;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form"  id="form" >
            <input type="hidden" id="id" name="id">
            <div class="layui-form-item">
                <label class="layui-form-label" for="loginName">登录名</label>
                <div class="layui-input-inline">
                        <input type="text" name="loginName" id="loginName"  placeholder="请输入登录名" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="loginType">登录类型</label>
                <div class="layui-input-inline">
                        <select id="loginType" name="loginType"></select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="deviceName">设备名称</label>
                <div class="layui-input-inline">
                        <input type="text" name="deviceName" id="deviceName"  placeholder="请输入设备名称" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="ipAdress">ip地址</label>
                <div class="layui-input-inline">
                        <input type="text" name="ipAdress" id="ipAdress"  placeholder="请输入ip地址" class="layui-input" >
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="loginTime">登录时间</label>
                <div class="layui-input-inline">
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    var id = getUrlParam("id");
    init(id);
    function init(id){
        publicAjax (null,"system/loginlog/query",
                {
                    "id":id
                },true,null,function (r) {
                        if(r.code==2000){
                            $("#id").val(r.data.id);
                            $("#loginName").val(r.data.loginName);
                            $("#loginType").val(r.data.loginType);
                            $("#deviceName").val(r.data.deviceName);
                            $("#ipAdress").val(r.data.ipAdress);
                            $("#loginTime").val(r.data.loginTime);
                        }else{
                            layerror("查询失败",null);
                        }
                });
    }
    /**
     * 保存
     */
    function submit(){
        var data = $("#form").serializeJson();
        var url = 'system/loginlog/update';
        var obj = $(validform().form());
        if(!obj[0]){
            return false;
        }
        var result;
        publicAjax (null,url,data,false ,null,function (r) {
            if(r.code==2000){
                laysuccess("添加成功",null);
                result = r;
            }else{
                layerror("添加失败",null);
                result = r;
            }
        });
        return result;
    }


    //编写表单验证函数validform，在验证按钮注册按钮点击事件内调用验证函数对象
    function validform(){//flag 1保存2更新;
        return $("#form").validate({
            rules : {







    },
        messages : {
        }
    });
    }


</script>
</body>

</html>